package bigdata.backend.mata.test;

import bigdata.backend.datasource.entity.Datasource;
import bigdata.backend.datasource.service.DatasourceService;
import bigdata.backend.meta.dto.DorisColumnDiffItem;
import bigdata.backend.meta.entity.DorisTableMeta;
import bigdata.backend.meta.service.DorisMetaService;
import bigdata.backend.meta.service.DorisTableMetaService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class TestDorisMetaService {
    @Autowired
    private DatasourceService datasourceService;

    @Autowired
    private DorisTableMetaService dorisTableMetaService;

    @Autowired
    private DorisMetaService dorisMetaService;

    @Test
    public void test01() {
        DorisTableMeta storedTableMeta = dorisTableMetaService.getById("1996042639267708929");
        List<DorisColumnDiffItem> columnDiffItems = dorisMetaService.compareTableColumns(storedTableMeta.getTableName(), storedTableMeta);
        for (DorisColumnDiffItem columnDiffItem : columnDiffItems) {
            System.out.println(columnDiffItem);
             dorisMetaService.syncSingleDiffFromDorisToLocal(columnDiffItem, storedTableMeta);
            // break;
        }
    }
}
